<?php


namespace App\Http\Controllers\cms;


use App\Engine\BaseController;
use App\Models\Article as ArticleModel;
use function app\Utils\go;

class Article extends BaseController
{
    public function get()
    {
        $res=ArticleModel::with('imgs')->get();
        return go($res);

    }

    public function insert()
    {
        $res=ArticleModel::create($this->post);
        return go($res);

    }

    public function update()
    {
        $res=ArticleModel::find($this->post['id'])->update($this->post);
        return go($res);
    }

    public function del()
    {
        $res=ArticleModel::destroy($this->get['id']);
        return go($res);
    }
}
